home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 001-025 / disk_014 / amiga3d / amiga.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  8KB  |  808 lines

  1. #include <exec/types.h>
  2. #include "threed.h"
  3.  
  4. extern struct Object Universe;
  5. extern struct UV universematrix;
  6. extern struct Coordinate universeposition;
  7.  
  8. extern int universeprocedure();
  9.  
  10. extern struct Object AmigaObject;
  11. extern struct UV amigamatrix;
  12. extern struct Coordinate amigaposition;
  13. extern struct Coordinate *amigapoints[];
  14. extern struct Coordinate *amiganormals[];
  15. extern struct Polygon *amigapolygons[];
  16.  
  17. extern int amigaprocedure();
  18.  
  19. struct Object Universe =
  20. {
  21.     NULL,
  22.     &AmigaObject,
  23.     &universematrix,
  24.     &universeposition,
  25.     0,NULL,
  26.     0,NULL,
  27.     0,NULL,
  28.     NULL
  29. };
  30.  
  31. struct Object *UniverseObject = &Universe;
  32.  
  33. struct UV universematrix =
  34. {
  35.     0x4000,
  36.     0x0000,
  37.     0x0000,
  38.     0x0000,
  39.     0x4000,
  40.     0x0000,
  41.     0x0000,
  42.     0x0000,
  43.     0x4000
  44. };
  45.  
  46. struct Coordinate universeposition =
  47. {
  48.     0,
  49.     0,
  50.     0
  51. };
  52.  
  53. struct Object AmigaObject =
  54. {
  55.     NULL,
  56.     NULL,
  57.     &amigamatrix,
  58.     &amigaposition,
  59.     54,amigapoints,
  60.     8,amiganormals,
  61.     11,amigapolygons,
  62.     amigaprocedure
  63. };
  64.  
  65.  
  66. struct UV amigamatrix =
  67. {
  68.     0x4000,
  69.     0x0000,
  70.     0x0000,
  71.     0x0000,
  72.     0x4000,
  73.     0x0000,
  74.     0x0000,
  75.     0x0000,
  76.     0x4000
  77. };
  78.  
  79.  
  80. struct Coordinate amigaposition =
  81. {
  82.     0xfff8,
  83.     0xffe8,
  84.     0xfc60
  85. };
  86.  
  87. struct Coordinate p0 =
  88. {
  89.     0xfef8,
  90.     0xffd0,
  91.     0xffe8
  92. };
  93.  
  94. struct Coordinate p1 =
  95. {
  96.     0xfef8,
  97.     0x0048,
  98.     0xffe8
  99. };
  100.  
  101. struct Coordinate p2 =
  102. {
  103.     0x0120,
  104.     0x0048,
  105.     0xffe8
  106. };
  107.  
  108. struct Coordinate p3 =
  109. {
  110.     0x0120,
  111.     0xffd0,
  112.     0xffe8
  113. };
  114.  
  115. struct Coordinate p4 =
  116. {
  117.     0xfef8,
  118.     0xffd0,
  119.     0x0018
  120. };
  121.  
  122. struct Coordinate p5 =
  123. {
  124.     0xfef8,
  125.     0x0048,
  126.     0x0018
  127. };
  128.  
  129. struct Coordinate p6 =
  130. {
  131.     0x0120,
  132.     0x0048,
  133.     0x0018
  134. };
  135.  
  136. struct Coordinate p7 =
  137. {
  138.     0x0120,
  139.     0xffd0,
  140.     0x0018
  141. };
  142.  
  143. struct Coordinate p8 =
  144. {
  145.     0xff40,
  146.     0xffe8,
  147.     0xffc8
  148. };
  149.  
  150. struct Coordinate p9 =
  151. {
  152.     0xff30,
  153.     0x0000,
  154.     0xffc8
  155. };
  156.  
  157. struct Coordinate p10 =
  158. {
  159.     0xff08,
  160.     0x0000,
  161.     0xffc8
  162. };
  163.  
  164. struct Coordinate p11 =
  165. {
  166.     0xff20,
  167.     0x0018,
  168.     0xffc8
  169. };
  170.  
  171. struct Coordinate p12 =
  172. {
  173.     0xff10,
  174.     0x0030,
  175.     0xffc8
  176. };
  177.  
  178. struct Coordinate p13 =
  179. {
  180.     0xff30,
  181.     0x0030,
  182.     0xffc8
  183. };
  184.  
  185. struct Coordinate p14 =
  186. {
  187.     0xff40,
  188.     0x0018,
  189.     0xffc8
  190. };
  191.  
  192. struct Coordinate p15 =
  193. {
  194.     0xff50,
  195.     0x0030,
  196.     0xffc8
  197. };
  198.  
  199. struct Coordinate p16 =
  200. {
  201.     0xff70,
  202.     0x0030,
  203.     0xffc8
  204. };
  205.  
  206. struct Coordinate p17 =
  207. {
  208.     0xff88,
  209.     0xffe8,
  210.     0xffc8
  211. };
  212.  
  213. struct Coordinate p18 =
  214. {
  215.     0xff88,
  216.     0x0030,
  217.     0xffc8
  218. };
  219.  
  220. struct Coordinate p19 =
  221. {
  222.     0xffa8,
  223.     0x0030,
  224.     0xffc8
  225. };
  226.  
  227. struct Coordinate p20 =
  228. {
  229.     0xffa8,
  230.     0x0018,
  231.     0xffc8
  232. };
  233.  
  234. struct Coordinate p21 =
  235. {
  236.     0xffb8,
  237.     0x0020,
  238.     0xffc8
  239. };
  240.  
  241. struct Coordinate p22 =
  242. {
  243.     0xffc8,
  244.     0x0018,
  245.     0xffc8
  246. };
  247.  
  248. struct Coordinate p23 =
  249. {
  250.     0xffc8,
  251.     0x0030,
  252.     0xffc8
  253. };
  254.  
  255. struct Coordinate p24 =
  256. {
  257.     0xffe8,
  258.     0x0030,
  259.     0xffc8
  260. };
  261.  
  262. struct Coordinate p25 =
  263. {
  264.     0xffe8,
  265.     0xffe8,
  266.     0xffc8
  267. };
  268.  
  269. struct Coordinate p26 =
  270. {
  271.     0xffb8,
  272.     0x0000,
  273.     0xffc8
  274. };
  275.  
  276. struct Coordinate p27 =
  277. {
  278.     0x0000,
  279.     0x0000,
  280.     0xffc8
  281. };
  282.  
  283. struct Coordinate p28 =
  284. {
  285.     0x0000,
  286.     0x0030,
  287.     0xffc8
  288. };
  289.  
  290. struct Coordinate p29 =
  291. {
  292.     0x0018,
  293.     0x0030,
  294.     0xffc8
  295. };
  296.  
  297. struct Coordinate p30 =
  298. {
  299.     0x0018,
  300.     0xffe8,
  301.     0xffc8
  302. };
  303.  
  304. struct Coordinate p31 =
  305. {
  306.     0x0048,
  307.     0xffe8,
  308.     0xffc8
  309. };
  310.  
  311. struct Coordinate p32 =
  312. {
  313.     0x0030,
  314.     0x0000,
  315.     0xffc8
  316. };
  317.  
  318. struct Coordinate p33 =
  319. {
  320.     0x0030,
  321.     0x0018,
  322.     0xffc8
  323. };
  324.  
  325. struct Coordinate p34 =
  326. {
  327.     0x0048,
  328.     0x0030,
  329.     0xffc8
  330. };
  331.  
  332. struct Coordinate p35 =
  333. {
  334.     0x0078,
  335.     0x0030,
  336.     0xffc8
  337. };
  338.  
  339. struct Coordinate p36 =
  340. {
  341.     0x0088,
  342.     0x0018,
  343.     0xffc8
  344. };
  345.  
  346. struct Coordinate p37 =
  347. {
  348.     0x00a0,
  349.     0x0018,
  350.     0xffc8
  351. };
  352.  
  353. struct Coordinate p38 =
  354. {
  355.     0x0090,
  356.     0x0008,
  357.     0xffc8
  358. };
  359.  
  360. struct Coordinate p39 =
  361. {
  362.     0x0068,
  363.     0x0008,
  364.     0xffc8
  365. };
  366.  
  367. struct Coordinate p40 =
  368. {
  369.     0x0078,
  370.     0x0018,
  371.     0xffc8
  372. };
  373.  
  374. struct Coordinate p41 =
  375. {
  376.     0x0060,
  377.     0x0018,
  378.     0xffc8
  379. };
  380.  
  381. struct Coordinate p42 =
  382. {
  383.     0x0048,
  384.     0x0000,
  385.     0xffc8
  386. };
  387.  
  388. struct Coordinate p43 =
  389. {
  390.     0x0060,
  391.     0x0000,
  392.     0xffc8
  393. };
  394.  
  395. struct Coordinate p44 =
  396. {
  397.     0x0078,
  398.     0xffe8,
  399.     0xffc8
  400. };
  401.  
  402. struct Coordinate p45 =
  403. {
  404.     0x00d8,
  405.     0xffe8,
  406.     0xffc8
  407. };
  408.  
  409. struct Coordinate p46 =
  410. {
  411.     0x00c8,
  412.     0x0000,
  413.     0xffc8
  414. };
  415.  
  416. struct Coordinate p47 =
  417. {
  418.     0x00a0,
  419.     0x0000,
  420.     0xffc8
  421. };
  422.  
  423. struct Coordinate p48 =
  424. {
  425.     0x00b8,
  426.     0x0018,
  427.     0xffc8
  428. };
  429.  
  430. struct Coordinate p49 =
  431. {
  432.     0x00a8,
  433.     0x0030,
  434.     0xffc8
  435. };
  436.  
  437. struct Coordinate p50 =
  438. {
  439.     0x00c8,
  440.     0x0030,
  441.     0xffc8
  442. };
  443.  
  444. struct Coordinate p51 =
  445. {
  446.     0x00d8,
  447.     0x0010,
  448.     0xffc8
  449. };
  450.  
  451. struct Coordinate p52 =
  452. {
  453.     0x00e8,
  454.     0x0030,
  455.     0xffc8
  456. };
  457.  
  458. struct Coordinate p53 =
  459. {
  460.     0x0108,
  461.     0x0030,
  462.     0xffc8
  463. };
  464.  
  465. struct Coordinate *amigapoints[54] =
  466. {
  467.     &p0,
  468.     &p1,
  469.     &p2,
  470.     &p3,
  471.     &p4,
  472.     &p5,
  473.     &p6,
  474.     &p7,
  475.     &p8,
  476.     &p9,
  477.     &p10,
  478.     &p11,
  479.     &p12,
  480.     &p13,
  481.     &p14,
  482.     &p15,
  483.     &p16,
  484.     &p17,
  485.     &p18,
  486.     &p19,
  487.     &p20,
  488.     &p21,
  489.     &p22,
  490.     &p23,
  491.     &p24,
  492.     &p25,
  493.     &p26,
  494.     &p27,
  495.     &p28,
  496.     &p29,
  497.     &p30,
  498.     &p31,
  499.     &p32,
  500.     &p33,
  501.     &p34,
  502.     &p35,
  503.     &p36,
  504.     &p37,
  505.     &p38,
  506.     &p39,
  507.     &p40,
  508.     &p41,
  509.     &p42,
  510.     &p43,
  511.     &p44,
  512.     &p45,
  513.     &p46,
  514.     &p47,
  515.     &p48,
  516.     &p49,
  517.     &p50,
  518.     &p51,
  519.     &p52,
  520.     &p53
  521. };
  522.  
  523. struct Coordinate n0 =
  524. {
  525.     0x0000,
  526.     0x0000,
  527.     0xc000
  528. };
  529.  
  530. struct Coordinate n1 =
  531. {
  532.     0x4000,
  533.     0x0000,
  534.     0x0000
  535. };
  536.  
  537. struct Coordinate n2 =
  538. {
  539.     0x0000,
  540.     0x0000,
  541.     0x4000
  542. };
  543.  
  544. struct Coordinate n3 =
  545. {
  546.     0xc000,
  547.     0x0000,
  548.     0x0000
  549. };
  550.  
  551. struct Coordinate n4 =
  552. {
  553.     0x0000,
  554.     0xc000,
  555.     0x0000
  556. };
  557.  
  558. struct Coordinate n5 =
  559. {
  560.     0x0000,
  561.     0x4000,
  562.     0x0000
  563. };
  564.  
  565. struct Coordinate n6 =
  566. {
  567.     0x0000,
  568.     0x0000,
  569.     0xc000
  570. };
  571.  
  572. struct Coordinate n7 =
  573. {
  574.     0x0000,
  575.     0x0000,
  576.     0xc000
  577. };
  578.  
  579. struct Coordinate *amiganormals[8] =
  580. {
  581.     &n0,
  582.     &n1,
  583.     &n2,
  584.     &n3,
  585.     &n4,
  586.     &n5,
  587.     &n6,
  588.     &n7
  589. };
  590.  
  591. struct Coordinate *v0[4] =
  592. {
  593.     &p0,
  594.     &p1,
  595.     &p2,
  596.     &p3
  597. };
  598.  
  599. struct Coordinate *v1[4] =
  600. {
  601.     &p3,
  602.     &p2,
  603.     &p6,
  604.     &p7
  605. };
  606.  
  607. struct Coordinate *v2[4] =
  608. {
  609.     &p7,
  610.     &p6,
  611.     &p5,
  612.     &p4
  613. };
  614.  
  615. struct Coordinate *v3[4] =
  616. {
  617.     &p4,
  618.     &p5,
  619.     &p1,
  620.     &p0
  621. };
  622.  
  623. struct Coordinate *v4[4] =
  624. {
  625.     &p4,
  626.     &p0,
  627.     &p3,
  628.     &p7
  629. };
  630.  
  631. struct Coordinate *v5[4] =
  632. {
  633.     &p2,
  634.     &p1,
  635.     &p5,
  636.     &p6
  637. };
  638.  
  639. struct Coordinate *v6[9] =
  640. {
  641.     &p9,
  642.     &p10,
  643.     &p11,
  644.     &p12,
  645.     &p13,
  646.     &p14,
  647.     &p15,
  648.     &p16,
  649.     &p8
  650. };
  651.  
  652. struct Coordinate *v7[10] =
  653. {
  654.     &p17,
  655.     &p18,
  656.     &p19,
  657.     &p20,
  658.     &p21,
  659.     &p22,
  660.     &p23,
  661.     &p24,
  662.     &p25,
  663.     &p26
  664. };
  665.  
  666. struct Coordinate *v8[4] =
  667. {
  668.     &p27,
  669.     &p28,
  670.     &p29,
  671.     &p30
  672. };
  673.  
  674. struct Coordinate *v9[14] =
  675. {
  676.     &p31,
  677.     &p32,
  678.     &p33,
  679.     &p34,
  680.     &p35,
  681.     &p36,
  682.     &p37,
  683.     &p38,
  684.     &p39,
  685.     &p40,
  686.     &p41,
  687.     &p42,
  688.     &p43,
  689.     &p44
  690. };
  691.  
  692. struct Coordinate *v10[9] =
  693. {
  694.     &p46,
  695.     &p47,
  696.     &p48,
  697.     &p49,
  698.     &p50,
  699.     &p51,
  700.     &p52,
  701.     &p53,
  702.     &p45
  703. };
  704.  
  705. struct Polygon f0 =
  706. {
  707.     4,
  708.     v0,
  709.     &n7,
  710.     7
  711. };
  712.  
  713. struct Polygon f1 =
  714. {
  715.     4,
  716.     v1,
  717.     &n1,
  718.     1
  719. };
  720.  
  721. struct Polygon f2 =
  722. {
  723.     4,
  724.     v2,
  725.     &n2,
  726.     2
  727. };
  728.  
  729. struct Polygon f3 =
  730. {
  731.     4,
  732.     v3,
  733.     &n3,
  734.     3
  735. };
  736.  
  737. struct Polygon f4 =
  738. {
  739.     4,
  740.     v4,
  741.     &n4,
  742.     4
  743. };
  744.  
  745. struct Polygon f5 =
  746. {
  747.     4,
  748.     v5,
  749.     &n5,
  750.     5
  751. };
  752.  
  753. struct Polygon f6 =
  754. {
  755.     9,
  756.     v6,
  757.     &n6,
  758.     6
  759. };
  760.  
  761. struct Polygon f7 =
  762. {
  763.     10,
  764.     v7,
  765.     &n6,
  766.     6
  767. };
  768.  
  769. struct Polygon f8 =
  770. {
  771.     4,
  772.     v8,
  773.     &n6,
  774.     6
  775. };
  776.  
  777. struct Polygon f9 =
  778. {
  779.     14,
  780.     v9,
  781.     &n6,
  782.     6
  783. };
  784.  
  785. struct Polygon f10 =
  786. {
  787.     9,
  788.     v10,
  789.     &n6,
  790.     6
  791. };
  792.  
  793. struct Polygon *amigapolygons[11] =
  794. {
  795.     &f0,
  796.     &f1,
  797.     &f2,
  798.     &f3,
  799.     &f4,
  800.     &f5,
  801.     &f6,
  802.     &f7,
  803.     &f8,
  804.     &f9,
  805.     &f10
  806. };
  807.  
  808.